package com.heer.gymnasium.module.team.beans;

import com.heer.gymnasium.base.BaseBean;
import com.heer.gymnasium.util.StringUtils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * Created by yan
 * on 2018/2/12
 */

public class TeamDetailBean {
    private String id;

    private String captainId;

    private String name;

    private String iconUrl;

    private String actionCount;

    private int teamType;

    private String catogeryId;
    private String catogery;

    private List<String> myTags;
    private List<String> otherTags;

    private String manifesto;

    private List<Item> memberList;

    private List<Item> historyList;


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCaptainId() {
        return captainId;
    }

    public void setCaptainId(String captainId) {
        this.captainId = captainId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIconUrl() {
        return iconUrl;
    }

    public void setIconUrl(String iconUrl) {
        this.iconUrl = iconUrl;
    }

    public String getActionCount() {
        return actionCount;
    }

    public void setActionCount(String actionCount) {
        this.actionCount = actionCount;
    }

    public int getTeamType() {
        return teamType;
    }

    public void setTeamType(int teamType) {
        this.teamType = teamType;
    }

    public List<String> getMyTags() {
        return myTags;
    }

    public void setMyTags(List<String> myTags) {
        this.myTags = myTags;
    }

    public String getManifesto() {
        return manifesto;
    }

    public void setManifesto(String manifesto) {
        this.manifesto = manifesto;
    }

    public List<Item> getMemberList() {
        return memberList;
    }

    public void setMemberList(List<Item> memberList) {
        this.memberList = memberList;
    }

    public List<Item> getHistoryList() {
        return historyList;
    }

    public void setHistoryList(List<Item> historyList) {
        this.historyList = historyList;
    }

    public String getCatogeryId() {
        return catogeryId;
    }

    public void setCatogeryId(String catogeryId) {
        this.catogeryId = catogeryId;
    }

    public String getCatogery() {
        return catogery;
    }

    public void setCatogery(String catogery) {
        this.catogery = catogery;
    }

    public static TeamDetailBean dataChange(TeamResponseBean.Info data) {
        TeamDetailBean bean = new TeamDetailBean();
        bean.setId(data.getCorps_id());
        bean.setCaptainId(data.getCaptain_id());
        bean.setIconUrl(data.getLogo());
        bean.setActionCount(data.getActivity_num());
        bean.setName(data.getCorps_name());
        bean.setCatogery(data.getCaregory());
        bean.setManifesto(data.getDecl());
        bean.setMyTags(data.getTag_me());
        bean.setOtherTags(data.getTag_other());
        bean.setCatogeryId(data.getCategory_id());
        if (data.getLevel().equals("青铜战队")) {
            bean.setTeamType(4);
        } else if (data.getLevel().equals("白银战队")) {
            bean.setTeamType(3);
        } else if (data.getLevel().equals("黄金战队")) {
            bean.setTeamType(2);
        } else if (data.getLevel().equals("白金战队")) {
            bean.setTeamType(1);
        }
        return bean;
    }

    public static Collection<? extends Item> getMemberList(List<TeamMemberResponseBean.Item> data) {
        List<Item> itemList = new ArrayList<>();
        for (TeamMemberResponseBean.Item item : data) {
            Item mItem = new Item();
            mItem.setName(item.getNickname());
            mItem.setId(item.getUser_id());
            mItem.setActionCount(item.getActivity_num());
            mItem.setIconUrl(item.getAvatar());
            itemList.add(mItem);
        }
        return itemList;
    }

    public static Collection<? extends Item> getHistoryList(List<ActivityHistoryResponseBean.Item> data) {
        List<Item> itemList = new ArrayList<>();
        for (ActivityHistoryResponseBean.Item item : data) {
            Item mItem = new Item();
            mItem.setName(item.getCorps_name());
            mItem.setTime(item.getTime());
            mItem.setIconUrl(item.getCorps_logo());
            mItem.setBattleType(item.getType());
            mItem.setQuickType(1);
            itemList.add(mItem);
        }
        return itemList;
    }

    public static int getMemberTotalPage(TeamMemberResponseBean data) {
        if (data != null) {
            return StringUtils.toInt(data.getTotal());
        }
        return 0;
    }

    public List<String> getOtherTags() {
        return otherTags;
    }

    public void setOtherTags(List<String> otherTags) {
        this.otherTags = otherTags;
    }

    public static class Item extends BaseBean {
        private String id;

        private String name;

        private String iconUrl;

        private String actionCount;
        private long time;

        private String battleType;

        private String trsmName;


        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getIconUrl() {
            return iconUrl;
        }

        public void setIconUrl(String iconUrl) {
            this.iconUrl = iconUrl;
        }

        public String getActionCount() {
            return actionCount;
        }

        public void setActionCount(String actionCount) {
            this.actionCount = actionCount;
        }


        public long getTime() {
            return time;
        }

        public void setTime(long time) {
            this.time = time;
        }

        public String getBattleType() {
            return battleType;
        }

        public void setBattleType(String battleType) {
            this.battleType = battleType;
        }

        public String getTrsmName() {
            return trsmName;
        }

        public void setTrsmName(String trsmName) {
            this.trsmName = trsmName;
        }


    }

    public class Tag {
        private String tag;

        public String getTag() {
            return tag;
        }

        public void setTag(String tag) {
            this.tag = tag;
        }
    }
}
